---
title: Azure OpenAI Tools
---

## Code

```python cookbook/tools/azure_openai_tools.py
from agno.agent import Agent
from agno.tools.models.azure_openai import AzureOpenAITools

agent = Agent(
    instructions=[
        "You are an AI image generation assistant using Azure OpenAI",
        "Generate high-quality images based on user descriptions",
        "Provide detailed descriptions of the generated images",
    ],
    tools=[AzureOpenAITools()],
    markdown=True,
)

agent.print_response("Generate an image of a sunset over mountains")
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your credentials">
    ```bash
    export AZURE_OPENAI_API_KEY=your-azure-openai-api-key
    export AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
    export AZURE_OPENAI_IMAGE_DEPLOYMENT=your-dalle-deployment-name
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Install libraries">
    ```bash
    pip install -U requests openai agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
    ```bash Mac
    python cookbook/tools/azure_openai_tools.py
    ```

    ```bash Windows
    python cookbook/tools/azure_openai_tools.py
    ```
    </CodeGroup>
  </Step>
</Steps>
